<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="/WEB-INF/tlds/spring.tld"%>
<%@ taglib prefix="c" uri="/WEB-INF/tlds/c.tld"%>
<c:set var="BasePath" value="${pageContext.request.contextPath}"></c:set>
<c:set var="Plugins" value="${pageContext.request.contextPath}/res/plugins"></c:set>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>库存盘点</title>
<link href="${Plugins}/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link href="${Plugins}/ligerUI/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
<script src="${Plugins}/datepicker/WdatePicker.js" type="text/javascript"></script>
<script src="${Plugins}/jquery/jquery-1.3.2.min.js"	type="text/javascript"></script>
<script src="${Plugins}/ligerUI/js/ligerui.min.js" type="text/javascript"></script>
<script src="${BasePath}/res/js/common/utils.js" type="text/javascript"></script>
<script type="text/javascript" src="${BasePath}/res/js/ligerCommon.js"></script>
<style type="text/css">
#searchbar {
    margin-bottom: 10px;
    margin-left: 15px;
}
.navbar {
		height: 20px;
		border-bottom: #E6E6E6 solid 1px;
		line-height: 20px;
	}
.l-button-search{
	width: 50px;
	margin-left: 10px;
	padding-bottom: 2px;
	display: inline;
}
</style>
</head>
<body style="padding:6px; overflow:hidden;">
<div id="">
	<div class="navbar"><span>您当前的位置：商品库存管理 &gt;库存盘点记录 </span></div>
	<form action="#"  name="queryForm" id="queryForm" method="POST">
	  <div id="searchbar">
	  <br>
		库存编号：<input type="text" id="pId" name="pId" size="18" maxLength="40" value="${inventoryCheck.pId }">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		仓库编号：<input type="text" id="whNo" name="whNo" size="18" maxLength="40" value="${inventoryCheck.whNo }">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		供应商编号：<input type="text" id="supNo" name="supNo" size="18" maxLength="40" value="${inventoryCheck.supNo }">&nbsp;&nbsp;&nbsp;&nbsp;
		<c:choose>
		  <c:when test="${role == 'PURCHASE_MAN'}">
			<input type="hidden" id="createPersonName" name="createPersonName" value="${poQueryVo.createPersonName }">
		  </c:when>
		</c:choose>
		 <input  type="submit" value="查询" class="l-button-search"  >&nbsp;&nbsp;&nbsp;&nbsp;<input  type="button" id="resetButton" value="重置" class="l-button-search" > 
	  </div>  
	</form>
	<br/>
</div>
<div id="maingrid6" style="margin:0; padding:0"></div>
  <div style="display:none;">
  <!-- g data total ttt -->
</div>
<script type="text/javascript">
	var basePath='${BasePath}';
    var grid = null;
    $(function () {
    	$('#resetButton').click(function() {
        	$('#pId').val('');
        	$('#whNo').val('');
        	 $('#supNo').val(''); 
        	$("select").find("option[value='']").attr("selected","true");   
        });
        grid = $("#maingrid6").ligerGrid({
            columns: [
            { display: '库存编号', name: 'pId'},
            { display: '仓库编号', name: 'whNo'},
            { display: '供应商编号', name: 'supNo'},
            { display: '货品编号', name: 'prodNo'},
            { display: '商品编号', name: 'commoNo'},
            { display: '商品总数', name: 'productTotal'},
            { display: '系统商品总数', name: 'sysProduct'},
            { display: '良品数量', name: 'yieldProduct'},
            { display: '系统良品数量', name: 'sysYieldProduct' },
            { display: '次品数量', name: 'defectProduct'},
            { display: '系统次品数量', name: 'sysDefectProduct'},
            { display: '是否系统数据', name: 'isSysData',  render: function (rowdata, rowindex, value) {
            	if (value == 1) {
            		return '是';
            	} else {
            		return '否';
            	}
            } },
            { display: '可用数量', name: 'qualifiedQuantity', width: '5%',  },
            { display: '创建时间', name: 'createTime', width: '5%',  }
            ], 
            pageSize:30,
            width: '100%',
            height: '100%',
            dataType: 'server', 
            dataAction: 'server',
            pagesizeParmName: 'pageSize',
            parms: [
                    {name: "pId", value:$("#pId").val()},
                    {name: "whNo",value:$("#whNo").val()},
                    {name: "supNo", value:$("#supNo").val()},
            	],
            url: "ajaxToinventoryCheckList.do",
            toolbar: toolbar
        });
    });
    var toolbar = '';
    var toolbar;
    var roles = new Array();
    '<c:forEach items="${roleVos}" var="item">';
    roles.push('${item.roleCode}');
    '</c:forEach>';
    
    var rpm = 0;
	if (roles.length > 0) {
		var ex = [];
		var add = [];
		var items = [];
		for(var i=0; i<roles.length; i++) {
			//商品专员管理员
       		if(roles[i] == 'GOOD_PERSON' || roles[i] == 'SYSTEM_ADMIN'){
    			add = [{ text: "新增次品",id:"add", click: addCommodity, icon: "add"},{ line: true }];
    		}
    		if (roles[i] == 'GOODS_SUPERVISOR' || roles[i] == 'FINANCIAL_PRINCIPAL'  || roles[i] == 'SYSTEM_ADMIN') {
    			ex = [{text: '导出EXCEL', click: doExportExcel, icon: "print"},{ line: true }];
    		}
    	}
		items = items.concat(ex);
		items = items.concat(add);
		toolbar = {items : items};
	}
    
    
    
</script>
</body>
</html>